package com.zcl.javaClassAndObject.exception;

/**
 * @Description:
 * @author: zcl
 * @date: 2021/12/14  14:18
 */
public class FinallyWorks {
    static int count = 0;

    public static void main(String[] args) {
        while (true){
            try {
                if (count++ == 0 ){
                    throw new Exception();
                }
                System.out.println("No Exception");
            }catch (Exception e){
                System.out.println("Exception thrown");
            }finally {
                System.out.println("in finally clause");
                if (count == 2){
                    break;
                }
            }
        }
    }
}
/**
 * Exception thrown
 * in finally clause
 * No Exception
 * in finally clause
 * */